#打开读的源文件，打开写的目标文件
# f1 = open('/bin/ls','rb')
# f2 = open('/root/ls','wb')
#读文件取数据，写到f2中
# data = f1.read()
# f2.write(data)
#关闭文件
# f1.close()
# f2.close()
# 源和目的文件都是字面量，名称没意义
#
# src_fname = '/tmp/mimi'
# dst_fname = '/tmp/mima'
#
# src_fobj  = open(src_fname,'rb')
# dst_fobj  = open(dst_fname,'wb')
#
# while 1:
#     data = src_fname(4096)
#     if data == b'':
#     #if len(data) == 0:
#     #if not data:
#         break
#     dst_fobj.read(data)
# src_fobj.close()
# dst_fobj.close()

src_fname = '/tmp/mimi'
dst_fname = '/tmp/mima'

src_fobj = open(src_fname,'rb')
dst_fobj = open(dst_fname,'wb')

while 1:
    data = src_fobj.read(4096)


    if data == 0 :
        break
    dst_fobj.write(data)
src_fobj.close()
dst_fobj.close()
















